package com.cooloongwu.greendao.gen;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.cooloongwu.coolchat.entity.Chat;
import com.cooloongwu.coolchat.entity.Contact;
import com.cooloongwu.coolchat.entity.Conversation;
import com.cooloongwu.coolchat.entity.Group;
import com.cooloongwu.coolchat.entity.GroupUsers;

import com.cooloongwu.greendao.gen.ChatDao;
import com.cooloongwu.greendao.gen.ContactDao;
import com.cooloongwu.greendao.gen.ConversationDao;
import com.cooloongwu.greendao.gen.GroupDao;
import com.cooloongwu.greendao.gen.GroupUsersDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig chatDaoConfig;
    private final DaoConfig contactDaoConfig;
    private final DaoConfig conversationDaoConfig;
    private final DaoConfig groupDaoConfig;
    private final DaoConfig groupUsersDaoConfig;

    private final ChatDao chatDao;
    private final ContactDao contactDao;
    private final ConversationDao conversationDao;
    private final GroupDao groupDao;
    private final GroupUsersDao groupUsersDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        chatDaoConfig = daoConfigMap.get(ChatDao.class).clone();
        chatDaoConfig.initIdentityScope(type);

        contactDaoConfig = daoConfigMap.get(ContactDao.class).clone();
        contactDaoConfig.initIdentityScope(type);

        conversationDaoConfig = daoConfigMap.get(ConversationDao.class).clone();
        conversationDaoConfig.initIdentityScope(type);

        groupDaoConfig = daoConfigMap.get(GroupDao.class).clone();
        groupDaoConfig.initIdentityScope(type);

        groupUsersDaoConfig = daoConfigMap.get(GroupUsersDao.class).clone();
        groupUsersDaoConfig.initIdentityScope(type);

        chatDao = new ChatDao(chatDaoConfig, this);
        contactDao = new ContactDao(contactDaoConfig, this);
        conversationDao = new ConversationDao(conversationDaoConfig, this);
        groupDao = new GroupDao(groupDaoConfig, this);
        groupUsersDao = new GroupUsersDao(groupUsersDaoConfig, this);

        registerDao(Chat.class, chatDao);
        registerDao(Contact.class, contactDao);
        registerDao(Conversation.class, conversationDao);
        registerDao(Group.class, groupDao);
        registerDao(GroupUsers.class, groupUsersDao);
    }
    
    public void clear() {
        chatDaoConfig.clearIdentityScope();
        contactDaoConfig.clearIdentityScope();
        conversationDaoConfig.clearIdentityScope();
        groupDaoConfig.clearIdentityScope();
        groupUsersDaoConfig.clearIdentityScope();
    }

    public ChatDao getChatDao() {
        return chatDao;
    }

    public ContactDao getContactDao() {
        return contactDao;
    }

    public ConversationDao getConversationDao() {
        return conversationDao;
    }

    public GroupDao getGroupDao() {
        return groupDao;
    }

    public GroupUsersDao getGroupUsersDao() {
        return groupUsersDao;
    }

}
